<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

<script>
    var mon2 = 28;
	var arr = [31, mon2, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	var year = prompt("年");
	var mon = prompt("月");
	var day = prompt("日");
	var sum = 0;
	if ((year % 4 == 0 & year % 100 != 0) || (year % 400 == 0)) {
		mon2 = 29;
	}
	for (i = 0; i < mon - 1; i++) {
		sum += arr[i];
	}
	sum +=parseInt(day);

    alert(year+'年'+mon+'月'+day+'日是这一年的第'+sum+'天');


    const date = new Date();
    console.log(date.getFullYear());
    console.log(date.getMonth());    
    console.log(date.getDate());     
    console.log(date.getHours());   

    const date1 = new Date();
    date1.setFullYear(2025);
    console.log(date1.getFullYear()); 
    
    date1.setMonth(0);
    console.log(date1.getMonth()); 

    const date2 = new Date();
    console.log(date2.toString());  
    console.log(date2.toLocaleString());
    console.log(date2.toUTCString()); 

    const date3 = new Date();
    console.log(date3.valueOf()); 

    // for (var i = 0; i < 10; i++) {
    //     setTimeout(function(){
    //         console.log(i);
    //     },100)
    // };
    // 该代码运行后，会在控制台打印出10个10

    // for (let i = 0; i < 10; i++) {
    //     setTimeout(function(){
    //         console.log(i);
    //     },100)
    // };
</script>